package cn.siat.system.api.factory;

import cn.siat.common.core.domain.R;
import cn.siat.system.api.RemoteAlgorithmService;
import cn.siat.system.api.RemoteNoticeService;
import cn.siat.system.api.domain.SysNotice;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 用户服务降级处理
 * 
 * @author siat
 */
@Component
public class RemoteNoticeFallbackFactory implements FallbackFactory<RemoteNoticeService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteNoticeFallbackFactory.class);

    @Override
    public RemoteNoticeService create(Throwable throwable)
    {
        log.error("python服务调用失败:{}", throwable.getMessage());
        return (notice, source) -> R.fail("发送消息失败:" +throwable.getMessage());
    }
}
